package com.tjsinfo.tjsoa.system.bo;

import java.util.ArrayList;
import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;

import com.tjsinfo.tjsoa.Dao.IQbcDao;
import com.tjsinfo.tjsoa.system.vo.TSystemChangyongyuDefault;
import com.tjsinfo.tjsoa.system.vo.TSystemChangyongyuEntry;

public class SystemChangYongYuBO implements ISystemChangYongYuBO {
	private IQbcDao qbcDao;

	public void setQbcDao(IQbcDao qbcDao) {
		this.qbcDao = qbcDao;
	}

	public List<String> getUserChangYongYu(String mainId,Integer userId) {
		List<String> list=new ArrayList<String>();
		DetachedCriteria criteria2 = DetachedCriteria.forClass(TSystemChangyongyuDefault.class);
		criteria2.add(Restrictions.eq("mainId", Integer.valueOf(mainId)));
		List<TSystemChangyongyuDefault> list2=qbcDao.getCriteria(criteria2);
		for (TSystemChangyongyuDefault systemChangyongyuDefault : list2) {
			list.add(systemChangyongyuDefault.getSentence());
		}
		DetachedCriteria criteria = DetachedCriteria.forClass(TSystemChangyongyuEntry.class);
		criteria.add(Restrictions.eq("userId", userId));
		criteria.add(Restrictions.eq("mainId", Integer.valueOf(mainId)));
		List<TSystemChangyongyuEntry> list1=qbcDao.getCriteria(criteria);
		for (TSystemChangyongyuEntry systemChangyongyuEntry : list1) {
			list.add(systemChangyongyuEntry.getSentence());
		}
		return list;
		
	}

}
